import 'package:flutter/cupertino.dart';
import 'package:imember/Util/Global.dart';
import 'package:imember/Util/MyColor.dart';
import 'package:imember/Util/PageUtil.dart';
import 'package:imember/Widget/MyButton.dart';
import 'package:imember/Widget/MyDialog.dart';
import 'package:imember/Widget/MyInput.dart';
import 'package:imember/Widget/MyPage.dart';

import 'CashExpend_Amount.dart';
import 'SummaryDone.dart';

class CashExpend_AmountConfirm_Save extends StatefulWidget {
  @override
  State<StatefulWidget> createState() {
    return _CashExpend_AmountConfirm_Save();
  }
}

class _CashExpend_AmountConfirm_Save extends State {
  nextStepClick() {
    showTextDialog(context, "請填寫短溢原因");

    PageUtil().open(context, CashExpend_Amount());
  }

  @override
  Widget build(BuildContext context) {
    return MyPage(
        Container(
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.end,
            children: [
              Expanded(
                  child: SingleChildScrollView(
                      child: Row(mainAxisAlignment: MainAxisAlignment.spaceAround, crossAxisAlignment: CrossAxisAlignment.start, children: [
                Column(children: [
                  Input("台幣實點金額"),
                  Input("台幣應有金額"),
                  Input("台幣臨時支出金額"),
                  Input("台幣短溢金額"),
                  Input("台幣短溢原因"),
                  Container(height: 10),
                  Input("人民幣實點金額"),
                  Input("人民幣應有金額"),
                  Input("人民幣短溢金額", bgColor: MyColor.FFD4),
                  Input("人民幣短溢原因", bgColor: MyColor.FFD4),
                ]),
                Column(children: [
                  Input("信用卡實點金額"),
                  Input("信用卡應有金額"),
                  Input("行動支付金額"),
                  Input("信用卡短溢金額", bgColor: MyColor.FFD4),
                  Input("信用卡短溢原因", bgColor: MyColor.FFD4),
                  Container(height: 10),
                  Input("禮券實點金額"),
                  Input("禮券應有金額"),
                  Input("禮券短溢金額", bgColor: MyColor.FFD4),
                  Input("禮券短溢原因", bgColor: MyColor.FFD4),
                ])
              ]))),
              Container(
                  margin: EdgeInsets.fromLTRB(0, 0, 45, 35),
                  child: Row(mainAxisAlignment: MainAxisAlignment.end, children: [
                    IconBtn("儲存並列印", "ic_printer.png", width: 170),
                    Container(width: 13),
                    IconBtn("儲存", "ic_check.png", width: 120, bgColor: MyColor.Orange,onTap: (){
                      PageUtil().open(context, SummaryDone());
                    }),
                  ]))
            ],
          ),
        ),
        title: "金額確認");
  }
}

class Input extends StatelessWidget {
  String title;
  TextEditingController? controller;
  Color? bgColor;

  Input(this.title, {this.controller, this.bgColor});

  @override
  Widget build(BuildContext context) {
    return Container(
        margin: EdgeInsets.only(top: 20),
        alignment: Alignment.center,
        child: Row(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Container(width: 180, child: Text(title, style: TextStyle(fontSize: 17, color: MyColor.C70))),
            Container(
                height: 36,
                width: 300,
                padding: EdgeInsets.fromLTRB(18, 0, 18, 0),
                decoration: Global.getBoxBg(18, bgColor ?? MyColor.E7),
                alignment: Alignment.centerLeft,
                child: Text("0", style: TextStyle(fontSize: 18)))
          ],
        ));
  }
}
